#!/usr/bin/env python

import pyaudio
import wave
import sys

chunk = 1024

p = pyaudio.PyAudio()

wf1 = wave.open("samples/kick.wav", 'rb')
wf2 = wave.open("samples/hat.wav", 'rb')

# read data
data = wf1.readframes(chunk)
alldata1 = []
while data != '':
    alldata1.append(data)
    data = wf1.readframes(chunk)

data = wf2.readframes(chunk)
alldata2 = []
while data != '':
    alldata2.append(data)
    data = wf2.readframes(chunk)

data=''.join(alldata1)
wf = wave.open("testoutput.wav", 'wb')
wf.setnchannels(1)
wf.setsampwidth(p.get_sample_size(pyaudio.paInt16))
wf.setframerate(44100)
wf.writeframes(data)
data=''.join(alldata2)
wf.writeframes(data)
wf.close()
